package cn.com.nes.mybatis.agent.ope.mapper;

import cn.com.nes.mybatis.agent.ope.entity.IsDeviceProtocolDataItemInfo;
import cn.com.nes.site.entity.dto.DataItemsForDropdownDTO;
import cn.com.nes.site.entity.dto.monitor.GetFieldDtoListDto;
import cn.com.nes.site.entity.vo.monitor.GetEquipmentInfoOperationConditionHistoryVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * <p>
 * 设备协议查询指令返回数据项表 Mapper 接口
 * </p>
 *
 * @author nes
 * @since 2023-02-28
 */
public interface IsDeviceProtocolDataItemInfoMapper extends BaseMapper<IsDeviceProtocolDataItemInfo> {

    void deleteBatchByDataItemIds(List<String> deleteDataItemIds);

    void insertBatch(@Param("insert") Set<IsDeviceProtocolDataItemInfo> insertDataItems);

    void deleteBitControlDataItems(String protocolId);

    void resumeDataItemTemplateId(String protocolId);

    List<IsDeviceProtocolDataItemInfo> getDataItems(Page<IsDeviceProtocolDataItemInfo> page,
                                                    @Param("protocolId") String protocolId,
                                                    @Param("startRegisterAddress") Integer startRegisterAddress,
                                                    @Param("endRegisterAddress") Integer endRegisterAddress,
                                                    @Param("registerAddress") Integer registerAddress,
                                                    @Param("dataName") String dataName,
                                                    @Param("registerType") String registerType);

    List<DataItemsForDropdownDTO> getDataItemsForDropdown(@Param("manufacturerId") String manufacturerId,
                                                          @Param("protocolId") String protocolId,
                                                          @Param("dataItemName") String dataItemName,
                                                          @Param("checkFault") Integer checkFault);

    List<Map<String, String>> getDataItemsAndField(String protocolId);

    List<Map<String, String>> getAllFieldNames(@Param("protocolId") String protocolId,
                                               @Param("type") String type);

    List<GetFieldDtoListDto> getFieldDtoList(GetEquipmentInfoOperationConditionHistoryVo vo);


    List<Map<String, String>> getPlcDataItemsAndField(@Param("protocolId") String protocolId, @Param("sbId") String sbId);

}
